﻿using Century.Business.CMS;
using Century.CommonModule.Models;
using Century.EnterpriseLibrary.Configuration;
using Century.Web.UI.MVC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Century.CommonModule.Controllers
{
    public class SliderController  : CenturyAdminBaseController
    {
        //
        // GET: /Slider/
        public SliderController(ISiteService siteService) : base(siteService) { }

        public ActionResult Index()
        {
            List<string> images = ConfManager.Instance.Slider.Images;
            List<string> texts = ConfManager.Instance.Slider.Texts;
            List<SliderViewModel> model = new List<SliderViewModel>();
            for (int i = 0; i < images.Count; i++)
            {
                model.Add(new SliderViewModel
                {
                    ImageUrl = images[i],
                    SlidText = texts.Count > i ? texts[i] : string.Empty
                });
            }
            return PartialView(model);
        }

    }
}
